<template>
	<view class="page">
		<view class="">
			
			<u-swiper @click="toInfo" :list="bannerList" height="600" border-radius="10"></u-swiper>
		</view>
		<view class="p10">
			<view class="mb15" @click="toPage()">
				<image src="https://sxdj.zhiyunapi.com/coach/show/image/index1.jpg" style="width: 100%;" mode="widthFix"></image>
			</view>
			
			<view class="mb15" @click="toPage()">
				<image src="https://sxdj.zhiyunapi.com/coach/show/image/index2.jpg" style="width: 100%;" mode="widthFix"></image>
			</view>
			<view class="mb15" @click="toPage()">
				<image src="https://sxdj.zhiyunapi.com/coach/show/image/index3.jpg" style="width: 100%;" mode="widthFix"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
	
		data() {
			return {
				bannerList: ['https://sxdj.zhiyunapi.com/coach/show/image/banner.jpg','https://sxdj.zhiyunapi.com/coach/show/image/banner.jpg'],
			}
		},
		onLoad(e) {
			if (e.scene) {
				this.deshare(e.scene);
			} 
		},
		computed: {
			// 获取店铺联系人手机号
			shop_name() {
				return this.$store.state.config.shop_name || '';
			},
			shop_desc() {
				return this.$store.state.config.shop_desc || '';
			},
		},
		onShow() {
			this.$nextTick(()=>{
				this.initData()
			})
		},
		methods: {
			
				deshare(data) {
					this.$api.deshare({
						code: data
					}, res => {
						if (res.status) {
							// console.log(res.data);
							this.saveInviteCode(res.data.userShareCode); //存储邀请码
						} else {
							this.$common.errorToShow('失败', () => {
								// uni.navigateBack({
								// 	delta: 1
								// });
								this.gotoIndex();
							});
						}
					});
				},
			//存储邀请码
			saveInviteCode(invite) {
				if (invite && invite != '') {
					this.$db.set('invitecode', invite);
				}
			},
			getMap() {
			
				uni.chooseLocation({
					type: 'gcj02',
					success: (res) => {
						this.longitude = res.longitude;
						this.latitude = res.latitude;
						this.address = res.name;
					},
					fail(err) {
						console.log(err)
					}
				});
			},
			toPage(url){
				uni.navigateTo({
					url
				})
			},
			initData() {
				this.$api.slider({
						limit: 10,
						page: 1,
						code: 'tpl1_slider_worker'
					},
					res => {
						if (res.status) {
							this.bannerList =res.data.list
							
							
							
							let data = {
								article_id: this.$store.state.config.company_profile_id
							};
							this.$api.articleInfo(data, res => {
								if (res.status) {
									this.info = res.data;
								}
							});
						}
					}
				);
			}
		}
	}
</script>

<style lang="scss">
	
</style>